<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <div v-if="age>18">成年</div>
      <div v-else-if="age==18">刚好成年</div>
      <div v-else>未成年</div>
      <div v-if="flag">显示隐藏的元素</div>
      <div v-show="type==='A'">A模块</div>
      <div v-show="type==='B'">B模块</div>
    </div>
    <script src="vue.js"></script>
    <!-- 
        v-if 和v-show 区别 
        v-if 元素显示增加和删除
        v-show 元素的通过css的display属性控制显示隐藏
     -->
    <script>
      var vm = new Vue({
        el: '#app',
        data() {
          return {
            flag: true,
            age: 18,
            type: 'B'
          }
        }
      })
    </script>
  </body>
</html>
